{extend name="public:layout" /}
{block name="content"}
<div class="page">
  <div class="fixed-bar">
    <div class="item-title"><a class="back" href="{:url('config/extend')}" title="返回列表"><i class="icon iconfont icon-fanhui"></i></a>
      <div class="subject">
        <h3>网站设置 - 新增扩展配置</h3>
        <h5>网站全局内容基本选项设置</h5>
      </div>
    </div>
  </div>
  <!-- 操作说明 -->
  <div class="explanation" id="explanation">
    <div class="title" id="checkZoom"><i class="icon iconfont icon-dengpao"></i>
    <h4 alt="提示相关设置操作时应注意的要点" class="itip">操作提示</h4>
    <span id="explanationZoom" alt="收起提示" class="itip"></span>
    </div>
    <ul>
      <li>添加权限组，方便添加管理员时使用。</li>
    </ul>
  </div>
  <form action="{:url('config/extend')}" method="post" class="form-horizontal" name="form1">
      <input type="hidden" name="action" value="add">
      <div class="ncap-form-default">
      <div class="title">
          <h3>添加扩展配置项</h3>
      </div>
      <dl class="row">
        <dt class="tit">键名</dt>
        <dd class="opt">
          <input id="fieldname" name="fieldname" value="" type="text" class="input-txt">
          <p class="notic">注意：只允许英文、数组、下划线</p>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">名称</dt>
        <dd class="opt">
          <input id="setting[title]" name="setting[title]" value="" type="text" class="input-txt">
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">类型</dt>
        <dd class="opt">
          <select name="type" onchange="extend_type(this.value)">
                <option value="input">单行文本框</option>
                <option value="select">下拉框</option>
                <option value="textarea">多行文本框</option>
                <option value="radio">单选框</option>
                <option value="password">密码输入框</option>
          </select>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">提示</dt>
        <dd class="opt">
          <input id="setting[tips]" name="setting[tips]" value="" type="text" class="input-txt">
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">样式</dt>
        <dd class="opt">
          <input id="setting[style]" name="setting[style]" value="" type="text" class="input-txt">
        </dd>
      </dl>
      <dl class="row setting_radio" style="display:none">
        <dt class="tit">选项</dt>
        <dd class="opt">
          <textarea name="setting[option]" rows="6" class="tarea" id="setting[option]">选项名称1|选项值1</textarea>
          <p class="notic">注意：每行一个选项</p>
        </dd>
      </dl>
      <div class="fix-bot"><a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onclick="document.form1.submit()">确认提交</a></div>
      </div>
    </form>
</div>
<script type="text/javascript">
    function extend_type(type){
        if(type == 'radio' || type == 'select'){
            $('.setting_radio').show();
            $('.setting_radio textarea').attr('disabled',false);
        }else{
            $('.setting_radio').hide();
            $('.setting_radio textarea').attr('disabled',true);
        }
    }
</script>
{/block}
